<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddBuckleTypeToRepayRecord extends Migration
{
    private $table = 'repay_records';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table($this->table, function (Blueprint $table) {
            $table->unsignedTinyInteger('buckle_type')->default(0)->comment('0 => 走的资方或公共,1 => 裸扣');
            $table->string('buckle_order_id')->default('')->comment('京东裸扣的自己生成的订单号');
            $table->string('buckle_channel_order_id')->default('')->comment('京东裸扣他们的订单号');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if(Schema::hasTable($this->table)){
            Schema::table($this->table, function (Blueprint $table) {
                $table->dropColumn('buckle_type');
                $table->dropColumn('buckle_order_id');
                $table->dropColumn('buckle_channel_order_id');
            });
        }
    }
}
